<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;

$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
$setting=$this->plugin_setting('basic');
$return['banner']=$setting['hdps'];
$return['setting']=$setting;
if($_RQ['op']=='main'){
	
	exi($return);
}
/*******op*******/
if($_RQ['op']=='list'){
	//查询进入该页面的客户所有订单
	$params=array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']);
	if(isset($_RQ['status'])&& $_RQ['status'] != 10){
		$params['status']=intval($_RQ['status']);
		$return['status']=$_RQ['status'];
	}else{
		$return['status']=10;
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$order_list=pdo_getslice('jy_dati_canyu',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	if($order_list){
		foreach($order_list as &$item){
			$member=pdo_get('core_members',array('id'=>$item['mid'],'uniacid'=>$_SESSION['uniacid']));
			$activity=pdo_get('jy_dati_list',array('id'=>$item['datiid'],'uniacid'=>$_SESSION['uniacid']));
			$item['activity']=$activity;
			$item['createtime']=date('Y-m-d H:i:s', $item['createtime']);
			
		}
	}
	$return['list']=$order_list;
	exi($return);
}
//订单详情
if($_RQ['op']=='detail'){
	if(!$_RQ['id']){
	exi('订单不存在，请重新选择','error');
	}
	$order=pdo_get('jy_dati_canyu',array('uniacid'=>$_SESSION['uniacid'],'id'=>$_RQ['id']));
	//用户信息
	$member=pdo_get('core_members',array('uniacid'=>$_SESSION['uniacid'],'id'=>$order['mid']));
	//活动信息
	$item=pdo_get('jy_dati_list',array('uniacid'=>$_SESSION['uniacid'],'id'=>$order['datiid']));	
	$order['content']=json_decode($order['content'],true);
	$return['order']=$order;
	$return['member']=$member;
	$return['item']=$item;
	exi($return);
}